import Vue from 'vue'
import Router from 'vue-router'
Vue.use(Router)
var constantRouterMap = [

  {
    path: '/login',
    component: () => import('@/page/login'),
    // component: 'page/',
    name: 'login',
  }
]

/**
 * 防止报 Error: Redirected when going from "/login" to "/index" via a navigation guard 这个错
 * 就是先进行了路由跳转后存数据
 */
const originalPush = Router.prototype.push
Router.prototype.push = function push(location, onResolve, onReject) {
  if (onResolve || onReject) return originalPush.call(this, location, onResolve, onReject)
  return originalPush.call(this, location).catch(err => err)
}

Router.prototype.push = function push(location) {
  return originalPush.call(this, location).catch(err => err)
}

export default new Router({
  routes: constantRouterMap

})

// import Vue from 'vue'
// import Router from 'vue-router'
// import HelloWorld from '@/components/HelloWorld'
// import echert from '@/components/echert'

// Vue.use(Router)

// export default new Router({
//   routes: [{
//       path: '/',
//       name: 'HelloWorld',
//       component: HelloWorld
//     },
//     {
//       path: '/echert',
//       name: 'echert',
//       component: echert
//     },
//   ]
// })
